import os
import paramiko
import getpass

repoHost="vsys01775"
repoUser="blokhin_sn"

if __name__=="__main__":
    try:
        print("copy distributive to repo")
        ssh = paramiko.SSHClient()
        ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
        passw = getpass.getpass(f"Пароль {repoUser}@{repoHost}:")
        ssh.connect(repoHost,username=repoUser,password=passw)
        print(f"{repoHost} connected")
        sftp = ssh.open_sftp()
        localpath="D:\\work\\Укрупнение\\current\\pyExcelCons3\\dist\\Consolidation-v.1.2.0.3.zip"
        remotepath="/home/blokhin_sn/repo/Consolidation-v.1.2.0.3.zip"
        print("sftp opened")
        sftp.put(localpath,remotepath)
        print("file puted")
        sftp.close()
        ssh.close()
        print("connection closed")
    except Exception as exp:
        print(f"repo error: {exp}")